﻿
package system.data;

import java.util.*;

import framework.core.*;
/*
	Author    :Jackey
	CreateTime:2008-03-03 10:39:59
*/
public class WarehouseProductBase extends Table 
{
public static final String TABLE_NAME = "T_WAREHOUSE_PRODUCT";

private static final String BACKUP_TABLE_NAME = "T_WAREHOUSE_PRODUCT_BACKUP";

private static final String BACKUP_SEQ_NAME = "S_WAREHOUSE_PRODUCT_BACKUP";


public static final String ID = "ID";

public static final String WAREHOUSE_CODE = "WAREHOUSE_CODE";

public static final String PRODUCT_ID = "PRODUCT_ID";

public static final String DEFAULT_LOCATION_CODE = "DEFAULT_LOCATION_CODE";

public static final String BALANCE_MODE = "BALANCE_MODE";

public static final String MIN_COUNT = "MIN_COUNT";

public static final String MAX_COUNT = "MAX_COUNT";

public static final String FILL_COUNT = "FILL_COUNT";

public static final String KEEPER_STAFF_ID = "KEEPER_STAFF_ID";

public static final String CREATE_USER_ID = "CREATE_USER_ID";

public static final String CREATE_USER = "CREATE_USER";

public static final String CREATE_TIME = "CREATE_TIME";

public static final String LAST_UPDATE_USER_ID = "LAST_UPDATE_USER_ID";

public static final String LAST_UPDATE_USER = "LAST_UPDATE_USER";

public static final String LAST_UPDATE_TIME = "LAST_UPDATE_TIME";

public static final String IS_SYNC = "IS_SYNC";


public static Vector m_fields = null;


private String m_id = ""; //序号

private String m_warehouse_code = ""; //仓库编码

private String m_product_id = ""; //产品ID

private String m_default_location_code = ""; //默认货位

private String m_balance_mode = ""; //结算模式

private double m_min_count = Value.NULL_DOUBLE; //安全库存

private double m_max_count = Value.NULL_DOUBLE; //最大库存

private double m_fill_count = Value.NULL_DOUBLE; //建议补货量

private String m_keeper_staff_id = ""; //保管员

private String m_create_user_id = ""; //创建人序号

private String m_create_user = ""; //创建人

private String m_create_time = ""; //创建时间

private String m_last_update_user_id = ""; //最后修改人序号

private String m_last_update_user = ""; //最后修改人

private String m_last_update_time = ""; //最后修改时间

private String m_is_sync = ""; //是否已同步



	public String getId()
	{
	    return m_id;
	}
	public void  setId(String v)
	{
		if(getId().equals(v)) return ;
		m_id = v ;
		markDirty(ID);
	}



	

	public String getWarehouseCode()
	{
	    return m_warehouse_code;
	}
	public void  setWarehouseCode(String v)
	{
		if(getWarehouseCode().equals(v)) return ;
		m_warehouse_code = v ;
		markDirty(WAREHOUSE_CODE);
	}



	

	public String getProductId()
	{
	    return m_product_id;
	}
	public void  setProductId(String v)
	{
		if(getProductId().equals(v)) return ;
		m_product_id = v ;
		markDirty(PRODUCT_ID);
	}



	

	public String getDefaultLocationCode()
	{
	    return m_default_location_code;
	}
	public void  setDefaultLocationCode(String v)
	{
		if(getDefaultLocationCode().equals(v)) return ;
		m_default_location_code = v ;
		markDirty(DEFAULT_LOCATION_CODE);
	}



	

	public String getBalanceMode()
	{
	    return m_balance_mode;
	}
	public void  setBalanceMode(String v)
	{
		if(getBalanceMode().equals(v)) return ;
		m_balance_mode = v ;
		markDirty(BALANCE_MODE);
	}



	

	public double getMinCount()
	{
	    return m_min_count;
	}
	public void  setMinCount(double v)
	{
		if(getMinCount()==v) return ;
		m_min_count = v ;
		markDirty(MIN_COUNT);
	}



	

	public double getMaxCount()
	{
	    return m_max_count;
	}
	public void  setMaxCount(double v)
	{
		if(getMaxCount()==v) return ;
		m_max_count = v ;
		markDirty(MAX_COUNT);
	}



	

	public double getFillCount()
	{
	    return m_fill_count;
	}
	public void  setFillCount(double v)
	{
		if(getFillCount()==v) return ;
		m_fill_count = v ;
		markDirty(FILL_COUNT);
	}



	

	public String getKeeperStaffId()
	{
	    return m_keeper_staff_id;
	}
	public void  setKeeperStaffId(String v)
	{
		if(getKeeperStaffId().equals(v)) return ;
		m_keeper_staff_id = v ;
		markDirty(KEEPER_STAFF_ID);
	}



	

	public String getCreateUserId()
	{
	    return m_create_user_id;
	}
	public void  setCreateUserId(String v)
	{
		if(getCreateUserId().equals(v)) return ;
		m_create_user_id = v ;
		markDirty(CREATE_USER_ID);
	}



	

	public String getCreateUser()
	{
	    return m_create_user;
	}
	public void  setCreateUser(String v)
	{
		if(getCreateUser().equals(v)) return ;
		m_create_user = v ;
		markDirty(CREATE_USER);
	}



	

	public String getCreateTime()
	{
	    return m_create_time;
	}
	public void  setCreateTime(String v)
	{
		if(getCreateTime().equals(v)) return ;
		m_create_time = v ;
		markDirty(CREATE_TIME);
	}



	

	public String getLastUpdateUserId()
	{
	    return m_last_update_user_id;
	}
	public void  setLastUpdateUserId(String v)
	{
		if(getLastUpdateUserId().equals(v)) return ;
		m_last_update_user_id = v ;
		markDirty(LAST_UPDATE_USER_ID);
	}



	

	public String getLastUpdateUser()
	{
	    return m_last_update_user;
	}
	public void  setLastUpdateUser(String v)
	{
		if(getLastUpdateUser().equals(v)) return ;
		m_last_update_user = v ;
		markDirty(LAST_UPDATE_USER);
	}



	

	public String getLastUpdateTime()
	{
	    return m_last_update_time;
	}
	public void  setLastUpdateTime(String v)
	{
		if(getLastUpdateTime().equals(v)) return ;
		m_last_update_time = v ;
		markDirty(LAST_UPDATE_TIME);
	}



	

	public String getIsSync()
	{
	    return m_is_sync;
	}
	public void  setIsSync(String v)
	{
		if(getIsSync().equals(v)) return ;
		m_is_sync = v ;
		markDirty(IS_SYNC);
	}



	



	public String viewId(DBConnection con) throws Exception
	{
		return Value.view(getId());
	}

	public String viewWarehouseCode(DBConnection con) throws Exception
	{
		return Value.view(getWarehouseCode());
	}

	public String viewProductId(DBConnection con) throws Exception
	{
		return Value.view(getProductId());
	}

	public String viewDefaultLocationCode(DBConnection con) throws Exception
	{
		return Value.view(getDefaultLocationCode());
	}

	public String viewBalanceMode(DBConnection con) throws Exception
	{
		return Value.view(getBalanceMode());
	}

	public String viewMinCount(DBConnection con) throws Exception
	{
		return Value.view(getMinCount());
	}

	public String viewMaxCount(DBConnection con) throws Exception
	{
		return Value.view(getMaxCount());
	}

	public String viewFillCount(DBConnection con) throws Exception
	{
		return Value.view(getFillCount());
	}

	public String viewKeeperStaffId(DBConnection con) throws Exception
	{
		return Value.view(getKeeperStaffId());
	}

	public String viewCreateUserId(DBConnection con) throws Exception
	{
		return Value.view(getCreateUserId());
	}

	public String viewCreateUser(DBConnection con) throws Exception
	{
		return Value.view(getCreateUser());
	}

	public String viewCreateTime(DBConnection con) throws Exception
	{
		return Value.view(getCreateTime());
	}

	public String viewLastUpdateUserId(DBConnection con) throws Exception
	{
		return Value.view(getLastUpdateUserId());
	}

	public String viewLastUpdateUser(DBConnection con) throws Exception
	{
		return Value.view(getLastUpdateUser());
	}

	public String viewLastUpdateTime(DBConnection con) throws Exception
	{
		return Value.view(getLastUpdateTime());
	}

	public String viewIsSync(DBConnection con) throws Exception
	{
		return Value.view(getIsSync());
	}



protected WarehouseProductBase()
{
}

public void fill(WarehouseProductPageData pageData) throws Exception
{

	if(pageData.getId()!=null)
	{	
		setId(pageData.getId());
	}

	if(pageData.getWarehouseCode()!=null)
	{	
		setWarehouseCode(pageData.getWarehouseCode());
	}

	if(pageData.getProductId()!=null)
	{	
		setProductId(pageData.getProductId());
	}

	if(pageData.getDefaultLocationCode()!=null)
	{	
		setDefaultLocationCode(pageData.getDefaultLocationCode());
	}

	if(pageData.getBalanceMode()!=null)
	{	
		setBalanceMode(pageData.getBalanceMode());
	}

	if( pageData.getMinCount()!=null && 
	   !pageData.getMinCount().equals(""))
	{	
		setMinCount(Double.parseDouble(pageData.getMinCount()));
	}

	if( pageData.getMaxCount()!=null && 
	   !pageData.getMaxCount().equals(""))
	{	
		setMaxCount(Double.parseDouble(pageData.getMaxCount()));
	}

	if( pageData.getFillCount()!=null && 
	   !pageData.getFillCount().equals(""))
	{	
		setFillCount(Double.parseDouble(pageData.getFillCount()));
	}

	if(pageData.getKeeperStaffId()!=null)
	{	
		setKeeperStaffId(pageData.getKeeperStaffId());
	}

	if(pageData.getCreateUserId()!=null)
	{	
		setCreateUserId(pageData.getCreateUserId());
	}

	if(pageData.getCreateUser()!=null)
	{	
		setCreateUser(pageData.getCreateUser());
	}

	if(pageData.getCreateTime()!=null)
	{	
		setCreateTime(pageData.getCreateTime());
	}

	if(pageData.getLastUpdateUserId()!=null)
	{	
		setLastUpdateUserId(pageData.getLastUpdateUserId());
	}

	if(pageData.getLastUpdateUser()!=null)
	{	
		setLastUpdateUser(pageData.getLastUpdateUser());
	}

	if(pageData.getLastUpdateTime()!=null)
	{	
		setLastUpdateTime(pageData.getLastUpdateTime());
	}

	if(pageData.getIsSync()!=null)
	{	
		setIsSync(pageData.getIsSync());
	}

}

public String getTableName() 
{
	return TABLE_NAME;
}

public String getBackupTableName() 
{
	return BACKUP_TABLE_NAME;
}

public String getBackupSeqName() 
{
	return BACKUP_SEQ_NAME;
}

public java.util.Vector getFields() 
{
	if(m_fields==null)
	{
		m_fields = new Vector();

		m_fields.add(new Field(ID,Value.TYPE_STRING,true,true,32,"序号"));

		m_fields.add(new Field(WAREHOUSE_CODE,Value.TYPE_STRING,false,true,20,"仓库编码"));

		m_fields.add(new Field(PRODUCT_ID,Value.TYPE_STRING,false,true,32,"产品ID"));

		m_fields.add(new Field(DEFAULT_LOCATION_CODE,Value.TYPE_STRING,false,true,20,"默认货位"));

		m_fields.add(new Field(BALANCE_MODE,Value.TYPE_STRING,false,true,1,"结算模式"));

		m_fields.add(new Field(MIN_COUNT,Value.TYPE_DOUBLE,false,true,0,"安全库存"));

		m_fields.add(new Field(MAX_COUNT,Value.TYPE_DOUBLE,false,true,0,"最大库存"));

		m_fields.add(new Field(FILL_COUNT,Value.TYPE_DOUBLE,false,true,0,"建议补货量"));

		m_fields.add(new Field(KEEPER_STAFF_ID,Value.TYPE_STRING,false,false,32,"保管员"));

		m_fields.add(new Field(CREATE_USER_ID,Value.TYPE_STRING,false,true,32,"创建人序号"));

		m_fields.add(new Field(CREATE_USER,Value.TYPE_STRING,false,true,50,"创建人"));

		m_fields.add(new Field(CREATE_TIME,Value.TYPE_STRING,false,true,20,"创建时间"));

		m_fields.add(new Field(LAST_UPDATE_USER_ID,Value.TYPE_STRING,false,true,32,"最后修改人序号"));

		m_fields.add(new Field(LAST_UPDATE_USER,Value.TYPE_STRING,false,true,50,"最后修改人"));

		m_fields.add(new Field(LAST_UPDATE_TIME,Value.TYPE_STRING,false,true,20,"最后修改时间"));

		m_fields.add(new Field(IS_SYNC,Value.TYPE_STRING,false,true,1,"是否已同步"));
		
	}
	return m_fields;
}

public void initObject(java.sql.ResultSet rs) throws Exception
{

	m_id = getString(rs,ID);

	m_warehouse_code = getString(rs,WAREHOUSE_CODE);

	m_product_id = getString(rs,PRODUCT_ID);

	m_default_location_code = getString(rs,DEFAULT_LOCATION_CODE);

	m_balance_mode = getString(rs,BALANCE_MODE);

	m_min_count = getDouble(rs,MIN_COUNT);

	m_max_count = getDouble(rs,MAX_COUNT);

	m_fill_count = getDouble(rs,FILL_COUNT);

	m_keeper_staff_id = getString(rs,KEEPER_STAFF_ID);

	m_create_user_id = getString(rs,CREATE_USER_ID);

	m_create_user = getString(rs,CREATE_USER);

	m_create_time = getString(rs,CREATE_TIME);

	m_last_update_user_id = getString(rs,LAST_UPDATE_USER_ID);

	m_last_update_user = getString(rs,LAST_UPDATE_USER);

	m_last_update_time = getString(rs,LAST_UPDATE_TIME);

	m_is_sync = getString(rs,IS_SYNC);

	ms_new_flag = ConstDefine.NO;
}

public Value get(String f)
{

	if(f.equalsIgnoreCase(ID))
	{
		return new Value(getId());
	}

	if(f.equalsIgnoreCase(WAREHOUSE_CODE))
	{
		return new Value(getWarehouseCode());
	}

	if(f.equalsIgnoreCase(PRODUCT_ID))
	{
		return new Value(getProductId());
	}

	if(f.equalsIgnoreCase(DEFAULT_LOCATION_CODE))
	{
		return new Value(getDefaultLocationCode());
	}

	if(f.equalsIgnoreCase(BALANCE_MODE))
	{
		return new Value(getBalanceMode());
	}

	if(f.equalsIgnoreCase(MIN_COUNT))
	{
		return new Value(getMinCount());
	}

	if(f.equalsIgnoreCase(MAX_COUNT))
	{
		return new Value(getMaxCount());
	}

	if(f.equalsIgnoreCase(FILL_COUNT))
	{
		return new Value(getFillCount());
	}

	if(f.equalsIgnoreCase(KEEPER_STAFF_ID))
	{
		return new Value(getKeeperStaffId());
	}

	if(f.equalsIgnoreCase(CREATE_USER_ID))
	{
		return new Value(getCreateUserId());
	}

	if(f.equalsIgnoreCase(CREATE_USER))
	{
		return new Value(getCreateUser());
	}

	if(f.equalsIgnoreCase(CREATE_TIME))
	{
		return new Value(getCreateTime());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_USER_ID))
	{
		return new Value(getLastUpdateUserId());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_USER))
	{
		return new Value(getLastUpdateUser());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_TIME))
	{
		return new Value(getLastUpdateTime());
	}

	if(f.equalsIgnoreCase(IS_SYNC))
	{
		return new Value(getIsSync());
	}
	
	return null;
}
public void set(String f,Value v) throws Exception
{

	if(f.equalsIgnoreCase(ID))
	{
		setId(v.getString());
	}

	if(f.equalsIgnoreCase(WAREHOUSE_CODE))
	{
		setWarehouseCode(v.getString());
	}

	if(f.equalsIgnoreCase(PRODUCT_ID))
	{
		setProductId(v.getString());
	}

	if(f.equalsIgnoreCase(DEFAULT_LOCATION_CODE))
	{
		setDefaultLocationCode(v.getString());
	}

	if(f.equalsIgnoreCase(BALANCE_MODE))
	{
		setBalanceMode(v.getString());
	}

	if(f.equalsIgnoreCase(MIN_COUNT))
	{
		setMinCount(v.getDouble());
	}

	if(f.equalsIgnoreCase(MAX_COUNT))
	{
		setMaxCount(v.getDouble());
	}

	if(f.equalsIgnoreCase(FILL_COUNT))
	{
		setFillCount(v.getDouble());
	}

	if(f.equalsIgnoreCase(KEEPER_STAFF_ID))
	{
		setKeeperStaffId(v.getString());
	}

	if(f.equalsIgnoreCase(CREATE_USER_ID))
	{
		setCreateUserId(v.getString());
	}

	if(f.equalsIgnoreCase(CREATE_USER))
	{
		setCreateUser(v.getString());
	}

	if(f.equalsIgnoreCase(CREATE_TIME))
	{
		setCreateTime(v.getString());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_USER_ID))
	{
		setLastUpdateUserId(v.getString());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_USER))
	{
		setLastUpdateUser(v.getString());
	}

	if(f.equalsIgnoreCase(LAST_UPDATE_TIME))
	{
		setLastUpdateTime(v.getString());
	}

	if(f.equalsIgnoreCase(IS_SYNC))
	{
		setIsSync(v.getString());
	}
	
}
public String toString()
{
	String msg = "WarehouseProduct=\n";
	msg += "(\r\n";

	msg += "    序号(id)="+get("id")+"\r\n";

	msg += "    仓库编码(warehouse_code)="+get("warehouse_code")+"\r\n";

	msg += "    产品ID(product_id)="+get("product_id")+"\r\n";

	msg += "    默认货位(default_location_code)="+get("default_location_code")+"\r\n";

	msg += "    结算模式(balance_mode)="+get("balance_mode")+"\r\n";

	msg += "    安全库存(min_count)="+get("min_count")+"\r\n";

	msg += "    最大库存(max_count)="+get("max_count")+"\r\n";

	msg += "    建议补货量(fill_count)="+get("fill_count")+"\r\n";

	msg += "    保管员(keeper_staff_id)="+get("keeper_staff_id")+"\r\n";

	msg += "    创建人序号(create_user_id)="+get("create_user_id")+"\r\n";

	msg += "    创建人(create_user)="+get("create_user")+"\r\n";

	msg += "    创建时间(create_time)="+get("create_time")+"\r\n";

	msg += "    最后修改人序号(last_update_user_id)="+get("last_update_user_id")+"\r\n";

	msg += "    最后修改人(last_update_user)="+get("last_update_user")+"\r\n";

	msg += "    最后修改时间(last_update_time)="+get("last_update_time")+"\r\n";

	msg += "    是否已同步(is_sync)="+get("is_sync")+"\r\n";
		
	msg += ")\r\n";
	return msg;
}
public void copyBase(WarehouseProductBase srcObj)
{

	setWarehouseCode(srcObj.getWarehouseCode());

	setProductId(srcObj.getProductId());

	setDefaultLocationCode(srcObj.getDefaultLocationCode());

	setBalanceMode(srcObj.getBalanceMode());

	setMinCount(srcObj.getMinCount());

	setMaxCount(srcObj.getMaxCount());

	setFillCount(srcObj.getFillCount());

	setKeeperStaffId(srcObj.getKeeperStaffId());

	setCreateUserId(srcObj.getCreateUserId());

	setCreateUser(srcObj.getCreateUser());

	setCreateTime(srcObj.getCreateTime());

	setLastUpdateUserId(srcObj.getLastUpdateUserId());

	setLastUpdateUser(srcObj.getLastUpdateUser());

	setLastUpdateTime(srcObj.getLastUpdateTime());

	setIsSync(srcObj.getIsSync());

}

public String toXml() throws Exception
{
	String xml = "";
	xml += "<WarehouseProduct>";

	xml += "<Id>"+Value.view(getId())+"</Id>";

	xml += "<WarehouseCode>"+Value.view(getWarehouseCode())+"</WarehouseCode>";

	xml += "<ProductId>"+Value.view(getProductId())+"</ProductId>";

	xml += "<DefaultLocationCode>"+Value.view(getDefaultLocationCode())+"</DefaultLocationCode>";

	xml += "<BalanceMode>"+Value.view(getBalanceMode())+"</BalanceMode>";

	xml += "<MinCount>"+Value.view(getMinCount())+"</MinCount>";

	xml += "<MaxCount>"+Value.view(getMaxCount())+"</MaxCount>";

	xml += "<FillCount>"+Value.view(getFillCount())+"</FillCount>";

	xml += "<KeeperStaffId>"+Value.view(getKeeperStaffId())+"</KeeperStaffId>";

	xml += "<CreateUserId>"+Value.view(getCreateUserId())+"</CreateUserId>";

	xml += "<CreateUser>"+Value.view(getCreateUser())+"</CreateUser>";

	xml += "<CreateTime>"+Value.view(getCreateTime())+"</CreateTime>";

	xml += "<LastUpdateUserId>"+Value.view(getLastUpdateUserId())+"</LastUpdateUserId>";

	xml += "<LastUpdateUser>"+Value.view(getLastUpdateUser())+"</LastUpdateUser>";

	xml += "<LastUpdateTime>"+Value.view(getLastUpdateTime())+"</LastUpdateTime>";

	xml += "<IsSync>"+Value.view(getIsSync())+"</IsSync>";
	
	xml += "</WarehouseProduct>";
	return xml;
}

}
